/*
 * Copyright 2010 Daniel Kurka
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.pbaptista.rem.client;

import com.google.gwt.place.shared.PlaceController;
import com.google.web.bindery.event.shared.EventBus;
import com.google.web.bindery.event.shared.SimpleEventBus;
import com.pbaptista.rem.client.activities.pages.about.AboutView;
import com.pbaptista.rem.client.activities.pages.about.AboutViewImpl;
import com.pbaptista.rem.client.activities.pages.contact.ContactView;
import com.pbaptista.rem.client.activities.pages.contact.ContactViewImpl;
import com.pbaptista.rem.client.activities.pages.home.HomeView;
import com.pbaptista.rem.client.activities.pages.home.HomeViewImpl;
import com.pbaptista.rem.client.activities.pages.main.MainView;
import com.pbaptista.rem.client.activities.pages.main.MainViewImpl;
import com.pbaptista.rem.client.activities.pages.rent.RentView;
import com.pbaptista.rem.client.activities.pages.rent.RentViewImpl;
import com.pbaptista.rem.client.activities.pages.sale.SaleView;
import com.pbaptista.rem.client.activities.pages.sale.SaleViewImpl;
import com.pbaptista.rem.client.activities.pages.search.SearchView;
import com.pbaptista.rem.client.activities.pages.search.SearchViewImpl;

/**
 * @author Daniel Kurka
 * 
 */
public class ClientFactoryImpl implements ClientFactory {

	private EventBus eventBus;
	private PlaceController placeController;

	public ClientFactoryImpl() {
		eventBus = new SimpleEventBus();

		placeController = new PlaceController(eventBus);

	}

	@Override
	public EventBus getEventBus() {
		return eventBus;
	}

	@Override
	public PlaceController getPlaceController() {
		return placeController;
	}

	private AboutView aboutView;
	
	@Override
	public AboutView getAboutView() {
		if(aboutView == null)
			aboutView = new AboutViewImpl();
		return aboutView;
	}

	
	private ContactView contactView;
	@Override
	public ContactView getContactView() {
		if(contactView==null)
			contactView = new ContactViewImpl();
		return contactView;
	}

	private HomeView homeView;
	
	@Override
	public HomeView getHomeView() {
		if(homeView==null)
			homeView = new HomeViewImpl();
		return homeView;
	}

	private MainView mainView;
	
	@Override
	public MainView getMainView() {
		if(mainView==null)
			mainView = new MainViewImpl();
		return mainView;
	}

	private RentView rentView;
	
	@Override
	public RentView getRentView() {
		if(rentView==null)
			rentView= new RentViewImpl();
		return rentView;
	}
	
	private SaleView saleView;

	@Override
	public SaleView getSaleView() {
		if(saleView==null)
			saleView = new SaleViewImpl();
		return saleView;
	}

	private SearchView searchView;
	
	@Override
	public SearchView getSearchView() {
		if(searchView==null)
			searchView = new SearchViewImpl();
		return searchView;
	}

}
